home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Dialog / c / Show < prev    next >
Text File  |  1993-07-10  |  2KB  |  51 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Dialog.Show.c
  12.     Author:  Copyright © 1993 Tim Browse and Jason Williams
  13.     Version: 1.00 (10 Jul 1993)
  14.     Purpose: Very high level window (dialogue) handling -
  15.              Showing non-permanent (menu) dialogues
  16. */
  17.  
  18.  
  19. #include "DeskLib:Wimp.h"
  20. #include "DeskLib:WimpSWIs.h"
  21.  
  22. #include "DeskLib:Dialog.h"
  23. #include "DeskLib:Screen.h"
  24.  
  25.  
  26. extern void Dialog_Show(dialog dbox)
  27. /* Open the window in the centre of the screen as a menu */
  28. {
  29.   window_state  state;
  30.   wimp_point    win_size, pos;
  31.  
  32.   dbox->state.isstatic = FALSE;
  33.  
  34.   /* Get the window size */
  35.   Wimp_GetWindowState(dbox->window, &state);
  36.   win_size.x = state.openblock.screenrect.max.x -
  37.                  state.openblock.screenrect.min.x;
  38.   win_size.y = state.openblock.screenrect.max.y -
  39.                  state.openblock.screenrect.min.y;
  40.  
  41.   /*  Open it as a Menu so that clicks outside it and hitting escape will
  42.    *  close it. Open it in the centre of the screen
  43.    */
  44.   pos.x = (screen_size.x - win_size.x) / 2;
  45.   pos.y = (screen_size.y + win_size.y) / 2;
  46.   Wimp_CreateMenu((menu_block *) dbox->window, pos.x, pos.y);
  47.  
  48.   dbox->state.stillopen = TRUE;
  49. }
  50.  
  51.